load enso;

f1 = fit(month,pressure,'fourier2');
subplot(2,1,1);
plot(f1,month,pressure);
w = f1.w;
2*pi/w
f2 = fit(month,pressure,'fourier8');
plot(f2,month,pressure);
w = f2.w;
(2*pi)/w
w = (2*pi)/96;
coeffnames(f2);
coeffs = coeffvalues(f2);
coeffs(:,18) = w;
[f3,gof,output] = fit(month,pressure,'fourier8', 'StartPoint', coeffs);
plot(f3,month,pressure);
hold on
plot(f2, 'b');
hold off;
legend( 'Data', 'f3', 'f2');
fitoptions('Fourier8');
subplot(2,1,2);
plot(month,output.residuals);
